window.AvgSkd = {
    rootEl: null,
    loginPanel: null,
    init () {
        let avgDiv = document.createElement('div');
        avgDiv.style.position = 'absolute';
        avgDiv.style.top = '5px';
        avgDiv.style.right = '5px';
        avgDiv.style.width = '420px';
        avgDiv.style.height = '250px';
        avgDiv.style.backgroundColor = '#ff0000';
        avgDiv.style.display = 'none';
        document.body.appendChild(avgDiv);
        this.rootEl = avgDiv;
    },
    _loadPng () {
        let img = document.createElement('img');
        img.src = './sdk/icon.png';
        return img;
    },
    login () {
        console.log('hi, avg login');
        if (this.loginPanel) {
            this.loginPanel.parentElement.removeChild(this.loginPanel);
            this.loginPanel = null;
        }
        let panel = document.createElement('div');

        let span = document.createElement('span');
        span.innerText = 'login ...';
        panel.append(span);

        let img = this._loadPng();
        panel.appendChild(img);
        this.rootEl.appendChild(panel);
        this.loginPanel = panel;
        this.rootEl.style.display = 'block';
    },
    pay () {
        console.log('hi, avg pay');
    }
};
window.onload = function () {
    AvgSkd.init();
};
